﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="../CSS/style1.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/style4.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.showModalDialog.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.pager.js" type="text/javascript"></script>
    <script type="text/javascript">

        function date2str(date) {
            //null判断
            if (date == null) return "";
            //去掉左右的斜杠
            date = date.replace(/\//g, "");
            //将其转为一个日期对象
            eval("var d = new " + date + ";");
            //返回最终结果
            return d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";

        };
        //跳到另一个页面进行确认修改操作
        function showDispose(id) {
            $.showModalDialog("ServiceDetailDialog.htm?data=" + Math.random(), {id:id}, 550, 400, function (r) {

            });
        };
        function Load() {
            $(".dataTable tr:gt(0)").live("click", function () {
                $(".dataTable tr:gt(0)").css("background-color", "white");
                $(this).css("background-color", "green");
                $(".dataDiv div:first").css("background-image", "url(../images/bg.gif)");
                $(".dataDiv div:last").css("background-image", "url()");
            });
        }
        $(function () {
            ServiceType(); //显示服务类型
            LoadList(); //表格内容 
            Load();
        });

        function LoadList(){
            $("#pageDiv").empty().pager("CustomServicesWeb.ashx", { action: "paging" }, function (data) {
                //展示查询的结果
                $("#tab tr:gt(0)").remove();
                var tab = $("#tab").get(0);
                for (var i = 0; i < data.length; i++) {
                    var tr = tab.insertRow(-1);
                    tr.insertCell(-1).innerHTML = data[i].CSName || "";
                    tr.insertCell(-1).innerHTML = data[i].CSTitle || "";
                    tr.insertCell(-1).innerHTML = data[i].STName || "";
                    tr.insertCell(-1).innerHTML = date2str(data[i].CSCreateDate) || "";
                    tr.insertCell(-1).innerHTML = data[i].CSDueName || "";
                    tr.insertCell(-1).innerHTML = date2str(data[i].CSDueDate) || "";
                    tr.insertCell(-1).innerHTML = data[i].CSDueName || "";
                    tr.insertCell(-1).innerHTML = '<input type="image" src="../images/bt_detail.gif" onclick="showDispose('+data[i].CSID+')" />'||"";
                }
            });

        };

        //显示服务类型
        function ServiceType(){
            $.ajax({
               url: "ServiceCreate.asmx/SelectServiceType",
               type: "post",
               data: JSON.stringify({}),
               dataType: "json",
               contentType: "application/json",
               success: function (obj) {
                   var sel1 = $("#select1");
                   for (var i = 0; i < obj.d.length; i++) {
                       sel1.append('<option value="' + obj.d[i].STName + '">' + obj.d[i].STName + '</option>');
                   }
               }, error: function (xmlhttp) {
                   alert("错误：" + xmlhttp.responseText);
               }
           });

        };
        function cha(){
            var ser={
                action:"select",
                CSName: $("#txtCSname").val(),
                STName: $("#select1").val()
            };
            
            $("#pageDiv").empty().pager("CustomServicesWeb.ashx", ser, function (data) {
                //展示查询的结果
                $("#tab tr:gt(0)").remove();
                var tab = $("#tab").get(0);
                for (var i = 0; i < data.length; i++) {
                    var tr = tab.insertRow(-1);
                    tr.insertCell(-1).innerHTML = data[i].CSName || "";
                    tr.insertCell(-1).innerHTML = data[i].CSTitle || "";
                    tr.insertCell(-1).innerHTML = data[i].STName || "";
                    tr.insertCell(-1).innerHTML = date2str(data[i].CSCreateDate) || "";
                    tr.insertCell(-1).innerHTML = data[i].CSCreateName || "";
                    tr.insertCell(-1).innerHTML = date2str(data[i].CSDueDate) || "";
                    tr.insertCell(-1).innerHTML = data[i].CSDueName || "";
                    tr.insertCell(-1).innerHTML = '<input type="image" src="../images/bt_detail.gif" onclick="showDispose('+data[i].CSID+')" />'||"";
                }
            });

        };
    </script>
</head>
<body>
<div id="desDiv">
    <span>服务归档</span><br />
    已处理完成的客户服务历史记录查看
</div>
<table class="tableEdit" style="width:600px">
        <tr>
            <th>
                客户名称：
            </th>
            <td>
                <input type="text" id="txtCSname" style="color:blue;" />
            </td>
            <th>
                服务类型：
            </th>
            <td>
                <select id="select1" style="width:80px">
                    <option value="">全部</option>
                </select>
            </td>
        </tr>
        <tfoot>
            <tr>
                <td colspan="8">
                    <input type="button" value="查询" onclick="cha();" />
                </td>
            </tr>
        </tfoot>
</table>
<br />
<div id="dataDiv">
    <div id="headDiv">
    </div>
    <table class="dataTable" id="tab">
        <tr>
            <th align="center">客户名称</th>
            <th align="center">概要</th>
            <th align="center">服务类型</th>
            <th align="center">创建时间</th>
            <th align="center">创建人</th>
            <th align="center">分配时间</th>
            <th align="center">处理人</th>
            <th align="center">查看</th>
        </tr>
    </table>
    <div id="pageDiv">
    </div>
</div>
</body>
</html>
